<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Hexo使用笔记 | 沙漠中的勇者</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="Hexo新建笔记12345678910111213npm install hexo -g  //安装  npm update hexo -g 	//升级 hexo version  	//查看hexo的版本hexo init nodejs-hexo   //创建nodejs-hexo 名字的本地文件hexo init nodejs-hexo    //创建博客hexo init blog   //">
<meta name="keywords" content="Hexo">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo使用笔记">
<meta property="og:url" content="http://yoursite.com/2017/10/12/Hexo使用笔记/index.html">
<meta property="og:site_name" content="沙漠中的勇者">
<meta property="og:description" content="Hexo新建笔记12345678910111213npm install hexo -g  //安装  npm update hexo -g 	//升级 hexo version  	//查看hexo的版本hexo init nodejs-hexo   //创建nodejs-hexo 名字的本地文件hexo init nodejs-hexo    //创建博客hexo init blog   //">
<meta property="og:updated_time" content="2018-01-30T07:23:55.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Hexo使用笔记">
<meta name="twitter:description" content="Hexo新建笔记12345678910111213npm install hexo -g  //安装  npm update hexo -g 	//升级 hexo version  	//查看hexo的版本hexo init nodejs-hexo   //创建nodejs-hexo 名字的本地文件hexo init nodejs-hexo    //创建博客hexo init blog   //">
  
    <link rel="alternate" href="/atom.xml" title="沙漠中的勇者" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">沙漠中的勇者</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-Hexo使用笔记" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2017/10/12/Hexo使用笔记/" class="article-date">
  <time datetime="2017-10-12T01:58:03.000Z" itemprop="datePublished">2017-10-12</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/Hexo/">Hexo</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      Hexo使用笔记
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="Hexo新建笔记"><a href="#Hexo新建笔记" class="headerlink" title="Hexo新建笔记"></a>Hexo新建笔记</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo -g  //安装  </span><br><span class="line">npm update hexo -g 	//升级 </span><br><span class="line">hexo version  	//查看hexo的版本</span><br><span class="line">hexo init nodejs-hexo   //创建nodejs-hexo 名字的本地文件</span><br><span class="line">hexo init nodejs-hexo    //创建博客</span><br><span class="line">hexo init blog   //初始化，生成文件夹为blog</span><br><span class="line">cd blog  	//进入blog文件夹</span><br><span class="line">npm install     //安装依赖库</span><br><span class="line">hexo generate   //生成一套静态网页</span><br><span class="line">hexo server  //运行测试,浏览器打开地址，http://localhost:4000/</span><br><span class="line">hexo deploy   //进行部署。</span><br><span class="line"></span><br><span class="line">hexo new &quot;new article&quot;  //新建文章‘new article’</span><br></pre></td></tr></table></figure>
<a id="more"></a>
<blockquote>
<blockquote>
<p>新建的笔记文件路径：<code>source/_posts</code> 目录下, <code>new-article.md</code> 的文件, 打开文件, 文件开头采用的是yaml格式，用三条短横线分隔。下面是文章正文，采用用的是markdown格式。</p>
<p>####新建、删除或修改文章后，不需要重启hexo server，刷新一下即可预览。####</p>
</blockquote>
</blockquote>
<h2 id="Hexo文章属性设置"><a href="#Hexo文章属性设置" class="headerlink" title="Hexo文章属性设置"></a>Hexo文章属性设置</h2><p>设置            描述            Default<br>layout        Layout        post或page<br>title        文章的标题<br>date        创建日期        文件的创建日期<br>updated        修改日期        文件的修改日期<br>comments    是否开启评论    true<br>tags        标签<br>categories    分类<br>permalink    url中的名字    文件名</p>
<h2 id="Hexo摘要"><a href="#Hexo摘要" class="headerlink" title="Hexo摘要"></a>Hexo摘要</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">这里是文章的摘要部分&lt;!--more--&gt;后面才是文章的正文内容</span><br></pre></td></tr></table></figure>
<h2 id="layout"><a href="#layout" class="headerlink" title="layout"></a>layout</h2><p>如果你修改了layout，在<code>scaffolds</code>文件夹里一定要有名字对应的模版文件，否则会采用默认模版。</p>
<h2 id="Hexo草稿"><a href="#Hexo草稿" class="headerlink" title="Hexo草稿"></a>Hexo草稿</h2><p>草稿相当于很多博客都有的“私密文章”功能。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new draft &quot;new draft&quot;</span><br></pre></td></tr></table></figure></p>
<p>草稿会在<code>source/_drafts</code>目录下生成一个<code>new-draft.md</code>文件。但是这个文件不被显示在页面上，链接也访问不到。也就是说如果你想把某一篇文章移除显示，又不舍得删除，可以把它移动到<code>_drafts</code>目录之中。</p>
<p>如果你希望强行预览草稿，更改配置文件：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">render_drafts: true</span><br></pre></td></tr></table></figure></p>
<p>或者，如下方式启动预览：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server --drafts</span><br></pre></td></tr></table></figure></p>
<p>下面这条命令可以把草稿变成文章，或者页面：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo publish [layout] &lt;filename&gt;</span><br></pre></td></tr></table></figure></p>
<h2 id="找不到git部署"><a href="#找不到git部署" class="headerlink" title="找不到git部署"></a>找不到git部署</h2><p>ERROR Deployer not found: git<br>解决方法：npm install hexo-deployer-git –save </p>
<h2 id="hexo更换皮肤"><a href="#hexo更换皮肤" class="headerlink" title="hexo更换皮肤"></a>hexo更换皮肤</h2><ol>
<li><a href="https://hexo.io/themes/" target="_blank" rel="noopener">hexo官网选择皮肤:</a>  <code>git clone</code> </li>
<li>放到themes目录下</li>
<li>编辑文件_config.yml，找到theme一行，改成 theme: pacman</li>
<li>本地启动hexo服务器，打开浏览器 <a href="http://localhost:4000" target="_blank" rel="noopener">http://localhost:4000</a></li>
</ol>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2017/10/12/Hexo使用笔记/" data-id="cjd1fyauk0000ov68jrg5iaaf" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Hexo/">Hexo</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2018/01/30/hello-world/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          Hello World
        
      </div>
    </a>
  
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Categories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Hexo/">Hexo</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Hexo/">Hexo</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/Hexo/" style="font-size: 10px;">Hexo</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/01/">January 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/10/">October 2017</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2018/01/30/使用Hexo-Github一步步搭建属于自己的博客（基础）/">使用Hexo+Github一步步搭建属于自己的博客（基础）</a>
          </li>
        
          <li>
            <a href="/2018/01/30/myHexo/">myHexo</a>
          </li>
        
          <li>
            <a href="/2018/01/30/hello-world/">Hello World</a>
          </li>
        
          <li>
            <a href="/2017/10/12/Hexo使用笔记/">Hexo使用笔记</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2018 xuzheng<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>